package tt.dz.appaction;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import tt.dz.appaction.base.BaseController;
import tt.dz.common.Constants;
import tt.dz.common.PublicFunc;
import tt.dz.entity.AlipayLog;
import tt.dz.service.AlipayLogService;


/**
 * 支付宝通知控制层
 * @author xielf
 *
 */
@Controller
@RequestMapping("/alipay")
public class AlipayLogController extends BaseController{

	/**支付宝支付日志接口*/
	@Resource
	AlipayLogService alipayLogService;
	
	/**
	 * 添加支付日志
	 * @param request
	 * @param response
	 */
	@RequestMapping("addAlipay.do")
	public void addAlipay(AlipayLog alipayLog, HttpServletRequest request,HttpServletResponse response){
		
		String resultStr="";
		try {
			String resultCode = alipayLogService.addAlipayLog(alipayLog);
			resultStr = PublicFunc.getOutStr(resultCode, "ok", null);
		} catch (Exception e) {
			e.printStackTrace();
			resultStr = PublicFunc.getOutStr(Constants.JsonResponseCode.DATABASE_OP_ERROR, e.getMessage(), null);
		}
		this.outText(resultStr, response);
	}
	
}
